<?php
function shownav($pagelist)
{global $ttt;
$str="<script src=\"/jimu/normal/page.js\" type=\"text/javascript\"></script> ";
$str.= <<<NAV
<table cellspacing="0" sellpadding="0" border="0">
                  <form action="" method="post">
                    <tr bgcolor="">
                      <td ><script language="javascript">PageList($pagelist);</script></td>
                    </tr>
                  </form>
                </table>
NAV;
$ttt->assign('nav',$str);
}

function jsform(&$showjs,$diaofile=1)
{
switch($diaofile){
	case 2:{
$str= "<link href=\"/jimu/validator/css/validator.css\" rel=\"stylesheet\" type=\"text/css\" />
<script type=\"text/javascript\" src=\"/jimu/validator/js/mootools.js\" charset=\"gb2312\"></script>
<script type=\"text/javascript\" src=\"/jimu/validator/js/full-validator.js\" charset=\"gb2312\"></script>

<script type=\"text/javascript\">
Validator.setup({
	form : 'vform',
	configs : 'attribute,tag',//xml,tag
	warns : 'follow',
	color : {warn :'black', pass:'white'},
	events : {
		'zh[pw]' : {
			onLevelChange : function(n){
				$('passwordInfo').setStyle('background-position',  'left ' + [0, 22, 50, 75, 100][n] + '%');
			}
		}
	}
}).add({\"for\":\"zh[pw]\", \"rule\":\"password\",  \"level\":\"2\", \"empty\":\"密码不允许为空\", \"warn\":\"密码安全度太低\", \"tips\":\"请输入6~16位数字、字母及特殊字符的混合字符\", \"pass\":\"验证正确\"});
/*]]>*/
</script>";
break;
	}
case 1:{
$str="    <link href=\"/jimu/validator/css/validator.css\" rel=\"stylesheet\" type=\"text/css\" />
    <script type=\"text/javascript\" src=\"/jimu/validator/js/mootools.js\" charset=\"gb2312\"></script>
    <script type=\"text/javascript\" src=\"/jimu/validator/js/full-validator.js\" charset=\"gb2312\"></script>
        <script type=\"text/javascript\">
        /*<![CDATA[*/
        Validator.setup({
            form : 'vform',
            configs : 'attribute,tag',//xml,tag
            warns : 'follow',
            color : {warn :'black', pass:'white'}
        });
        /*]]>*/
        </script>";
        break;
        }
}
$showjs.=$str;
}


function ext(&$showjs)
{
$str= <<<JSDATE
    <link rel="stylesheet" type="text/css" href="/jimu/ext/resources/css/ext-all.css" />
    <script type="text/javascript" src="/jimu/ext/adapter/jquery/jquery.js"></script>
    <script type="text/javascript" src="/jimu/ext/adapter/jquery/ext-jquery-adapter.js"></script>
    <script type="text/javascript" src="/jimu/ext/ext-all.js"></script>

JSDATE;
$showjs.=$str;
}

function lightbox(&$showjs)
{
$str= <<<JSDATE

<link rel="stylesheet" href="/jimu/css/lightbox.css" type="text/css" media="screen" />
<script type="text/javascript" src="/jimu/lightbox/prototype.js"></script>
<script type="text/javascript" src="/jimu/lightbox/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="/jimu/lightbox/lightbox.js"></script>
JSDATE;
$showjs.=$str;
}
function my97(&$showjs)
{
$str="<script src=\"/jimu/My97/WdatePicker.js\" type=\"text/javascript\"></script>";
$showjs.=$str;
}
function huandeng($template,$pics,$links,$texts,$width,$height,$type,$textheight=26,$align=center,$time=0,$ml='jimu'){

	global $ttt;
		if($pics=='')
		{
		$pics="{$ml}/jimu/flash/hd/1.jpg|{$ml}/jimu/flash/hd/2.jpg|{$ml}/jimu/flash/hd/12.jpg|{$ml}/jimu/flash/hd/4.jpg|{$ml}/jimu/flash/hd/5.jpg|{$ml}/jimu/flash/hd/6.jpg|{$ml}/jimu/flash/hd/7.jpg|{$ml}/jimu/flash/hd/8.jpg|{$ml}/jimu/flash/hd/9.jpg|{$ml}/jimu/flash/hd/10.jpg|{$ml}/jimu/flash/hd/11.jpg|{$ml}/jimu/flash/hd/3.jpg";
		}

	switch($type){
		case 1:{

		$str=<<<HAHAHA
		<script type="text/javascript">
var swf_width={$width}
var swf_height={$height}
var files='{$pics}'
var links='{$links}'
var texts='{$texts}'

document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">');
document.write('<param name="movie" value="{$ml}/jimu/flash/hd/hd1.swf"><param name="quality" value="high">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'">');
document.write('<embed src="{$ml}/jimu/flash/hd/hd1.swf" wmode="opaque" FlashVars="bcastr_file='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'& menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'); document.write('</object>');

</script>


HAHAHA;
		break;

		}
		case 2:{
		$str=<<<HAHAHAHD2
		<script type="text/javascript">
<!--
var interval_time={$time}
var focus_width={$width}
var focus_height={$height}
var text_height={$textheight}
var text_align= '{$align}' //ֶ뷽ʽ(leftcenterright)
var swf_height = focus_height+text_height

var pics= '{$pics}'
var links='{$links}'
var texts='{$texts}'

document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="movie" value="{$ml}/jimu/flash/hd/hd2.swf"><param name="quality" value="high"><param name="bgcolor" value="#ffffff">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'">');
document.write('<embed src="{$ml}/jimu/flash/hd/hd2.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
//-->
</script>
HAHAHAHD2;
break;
		}

	}

$ttt->assign($template,$str);
}

function addjs($str)
{global $ttt;
$showjs='';
$temp=explode('#',$str);
	foreach($temp as $value)
	{
	$value($showjs);
	}
	$ttt->assign('showjs',$showjs);
}

function myright()
{global $ttt;
$str.= <<<NAV
<script language="javascript">window.onload=function(){var str1 ="?";var links=document.all.tags("A");var total=links.length;for (i=0;i<total;i++){var s =links[i].href.indexOf(str1);if(s>0){links[i].href=links[i].href+'&from=b&mid={$_GET[mid]}';}else{links[i].href=links[i].href+'?from=b&mid={$_GET[mid]}';}}}</script>
NAV;
$ttt->assign('myright',$str);
}
function addXajax($funcName,$printXajaxName='PrintXajax',$debug=0){
	global $xajaxFuncs;
	global $ttt;
	global $xxx;
	//Ja($xajaxFuncs);
	if(!is_array($xajaxFuncs)){
		$xajaxFuncs=array();
	}
	if(empty($xxx)){
		//unset($xxx);
		//$xxx = null;
		$xxx = new xajax();
		//$$xxx->bDecodeUTF8Input=true;
		$xxx->setFlag('decodeUTF8Input',true);
		//$debug!=0?$$xxx->DebugOn():'';	//0.5 pre
		$xxx->setFlag('debug',$debug!=0?true:false);
	}


	//测试函数是否存在
	if(!function_exists($funcName)){
		Ja('函数(function):['.$funcName.']不存在!');
		exit;
	}

	//新老函数合并
	if(array_search(trim($funcName),$xajaxFuncs)===false){
		array_push($xajaxFuncs,$funcName);
	}
	foreach($xajaxFuncs as $K => $V){
		//加入新注册函数
		$xxx->register(XAJAX_FUNCTION, $V);
	}


	if(strrpos($_SERVER['PHP_SELF'],'/admin/') === false){//前台
		$xajaxStr=$xxx->getJavascript('/includes/class/xajax_0.5/');
	}else{//后台
		$xajaxStr=$xxx->getJavascript('/includes/class/xajax_0.5/');
	}
	$ttt->assign($printXajaxName,$xajaxStr);
	$xxx->processRequest();
	return $xajaxStr;


}
function addXajaxEnd(){

	global $ttt;
	global $$xxx;

	if(strrpos($_SERVER['PHP_SELF'],'/admin/') === false){//前台
		$xajaxStr=$$xxx->getJavascript('/includes/class/xajax_0.5_rc2_full/');
	}else{//后台
		$xajaxStr=$$xxx->getJavascript('/includes/class/xajax_0.5_rc2_full/');
	}
	$ttt->assign($printXajaxName,$xajaxStr);
	$$xxx->processRequest();
	return $xajaxStr;
}
?>
